package uk.org.landeg.euler.problems.unported;

import java.math.BigDecimal;

public class Euler080 extends AbstractProblem {
	@Override
	public String solve() {
		
		double n = 100;
		double guess = 30;
		double delta;
		System.out.println(guess);
		for (int idx = 0 ; idx < 20 ; idx++) {
			delta = (guess * guess - n) * 0.5 / guess;
			guess -= delta;
			System.out.println(guess);
		}
		
		BigDecimal g = BigDecimal.valueOf(30);
		BigDecimal d;
		BigDecimal t = BigDecimal.valueOf(100);
		BigDecimal half = BigDecimal.valueOf(0.5);
		for (int idx =0 ; idx < 20 ; idx++) {
			d = g.multiply(g).subtract(t).multiply(half).divide(g);
			g = g.subtract(d);
			System.out.println(g);
		}
		return null;
	}
	
	public static void main(String[] args) {
		new Euler080().solve();
	}
	
	
}
